<?php
/**
 * 上年
*/

namespace houze\mongodb\query;

class lastyear {
    /**
     * 构造时间查询
    */
    public static function run($field, $where, $data) {
        $day = date('Y')-1;
        
        $start = strtotime($day.'-01-01', time());
        $end = strtotime($day.'-12-31', time())+86399;

        return [
            [
                'field' => $field,
                'where' => '>=',
                'value' => $start,
            ],
            [
                'field' => $field,
                'where' => '<',
                'value' => $end,
            ],
        ];
    }
}